﻿using J.Status.Application.Command.LodgingCommand;
using J.StatusModel.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using StatusDto;

namespace J.Status.Controllers
{
    /// <summary>
    /// 住宿记录
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LodgingController : ControllerBase
    {
        private readonly IMediator mediator;
        public LodgingController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 分页显示
        /// </summary>
        /// <param name="lodgingFindDto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageDto<LodgingDto>> LodgingList(LodgingSelectCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 回显
        /// </summary>
        /// <param name="LodgingFillCommand"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<LodgingAllDto>> LodgingOneData(LodgingFillCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
